package com.imut.hcdp.controller;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.imut.hcdp.domain.HcdpStation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import com.imut.hcdp.common.Rst;

import com.imut.hcdp.domain.HcdpTrainAll;
import com.imut.hcdp.service.IHcdpTrainAllService;



@RestController
@RequestMapping("/system/all")
public class HcdpTrainAllController
{
    @Autowired
    private IHcdpTrainAllService hcdpTrainAllService;



    @GetMapping("/list")
    public PageInfo list(HcdpTrainAll hcdpTrainAll, HttpServletRequest request)
    {
        String pageNum = request.getParameter("pageNum");
        String pageSize = request.getParameter("pageSize");
        PageHelper.startPage(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
        List<HcdpTrainAll> list = hcdpTrainAllService.selectHcdpTrainAllList(hcdpTrainAll);
        PageInfo<HcdpTrainAll> pageInfo = (PageInfo<HcdpTrainAll>)list;
        return pageInfo;
    }





    @GetMapping(value = "/{routeId}")
    public Rst getInfo(@PathVariable("routeId") Long routeId)
    {
        return Rst.success(hcdpTrainAllService.selectHcdpTrainAllByRouteId(routeId));
    }




    @PostMapping
    public Rst add(@RequestBody HcdpTrainAll hcdpTrainAll)
    {
        return Rst.success(hcdpTrainAllService.insertHcdpTrainAll(hcdpTrainAll));
    }




    @PutMapping
    public Rst edit(@RequestBody HcdpTrainAll hcdpTrainAll)
    {
        return Rst.success(hcdpTrainAllService.updateHcdpTrainAll(hcdpTrainAll));
    }




	@DeleteMapping("/{routeIds}")
    public Rst remove(@PathVariable Long[] routeIds)
    {
        return Rst.success(hcdpTrainAllService.deleteHcdpTrainAllByRouteIds(routeIds));
    }
}
